<template>
	<div>
		<el-card class="box-card" style="margin-top:15px">
			<div slot="header" class="clearfix">
				<span style="font-weight: bold">设置</span>
			</div>
			<el-row :gutter="15">
				<el-form label-width="80px">
					<el-col :span="12">
						<el-form-item label="给药途径">
							<el-input v-model="dosingUnit_name"  :readonly="true"  size="mini" style="width:150px;"></el-input>
							<el-button type="primary" size="mini" @click="openSelect(1)">选择</el-button>
							<el-button type="primary" size="mini" @click="clearFun(1)">清除</el-button>
						</el-form-item>
					</el-col>						
					<el-col :span="12">
						<el-form-item label="给药单位">
							<el-select v-model="submit.dosingUnit" size="small" placeholder="请选择">
								<el-option  label="ml" value="ml">
								</el-option>
							  </el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="计算方式">
							<el-select v-model="submit.calculation" size="small" placeholder="请选择">
								<el-option  label="常规" value="1"></el-option>
								<el-option  label="体重" value="2"></el-option>
								<el-option  label="体表" value="3"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="肝损">
							<el-select v-model="submit.degree" size="small" placeholder="请选择">
								<el-option  label="肝功能不全" value="1"></el-option>
								<el-option  label="轻度肝损害" value="2"></el-option>
								<el-option  label="中度肝损害" value="3"></el-option>
								<el-option  label="重度肝损害" value="4"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="年龄低值">
							<div class="dialogFirstRow">
								<el-select v-model="submit.age_low1" size="mini">
									<el-option label=">=" value="0"></el-option>
									<el-option label=">" value="1"></el-option>
								</el-select>
								<el-input v-model="submit.ageLow" v-only-number="{max:10000000000,min:0,precision:0}" size="mini" ></el-input>
								<el-select v-model="submit.age_low_unit1" size="mini">
									<el-option v-for="item in ageOptions" :key="item.value" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</div>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="年龄高值">
							<div class="dialogFirstRow">
								<el-select v-model="submit.age_high1" size="mini">
									<el-option label="<=" value="0"></el-option>
									<el-option label="<" value="1"></el-option>
								</el-select>
								<el-input v-model="submit.ageH" v-only-number="{max:10000000000,min:0,precision:0}" size="mini"></el-input>
								<el-select v-model="submit.age_high_unit1" size="mini">
									<el-option v-for="item in ageOptions" :key="item.value" :label="item.label" :value="item.value">
									</el-option>
								</el-select>
							</div>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="疾病状态">
							<el-input v-model="diseaseName"  :readonly="true"  size="mini" style="width:150px;"></el-input>
							<el-button type="primary" size="mini" @click="openSelect(2)">选择</el-button>
							<el-button type="primary" size="mini" @click="clearFun(2)">清除</el-button>
						</el-form-item>
					</el-col>
					<el-col :span="24" style="border-bottom:1px dashed #afafaf;margin-bottom:16px;"></el-col>
					<el-col :span="12">
						<el-form-item label="每次剂量">
							<div style="display:inline-block;">低值/</div>
							<el-input v-model="submit.doseRangeL" size="small" style="width:60px;"></el-input>
							<div style="display:inline-block;">次/ml</div>
							<div style="display:inline-block;">高值/</div>
							<el-input v-model="submit.doseRangeH" size="small" style="width:60px;"></el-input>
							<div style="display:inline-block;">日/ml</div>
						</el-form-item>
					</el-col>
					<el-col :span="12">
						<el-form-item label="每日剂量">
							<div style="display:inline-block;">低值/</div>
							<el-input v-model="submit.dailyDoseL" size="small" style="width:60px;"></el-input>
							<div style="display:inline-block;">次/ml</div>
							<div style="display:inline-block;">高值/</div>
							<el-input v-model="submit.dailyDoseH" size="small" style="width:60px;"></el-input>
							<div style="display:inline-block;">日/ml</div>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="给药频次">
							<div style="display:inline-block;">低值/</div>
							<el-input v-model="submit.dosingFrequencyLow" size="small" style="width:60px;"></el-input>
							<div style="display:inline-block;">次/</div>
							<el-input v-model="submit.dosingFrequencyLowDay" size="small" style="width:60px;"></el-input>
							<div style="display:inline-block;">日</div>
							
							<div style="display:inline-block;">高值/</div>
							<el-input v-model="submit.dosingFrequencyHight" size="small" style="width:60px;"></el-input>
							<div style="display:inline-block;">次/</div>
							<el-input v-model="submit.dosingFrequencyHightDay" size="small" style="width:60px;"></el-input>
							<div style="display:inline-block;">日</div>
						</el-form-item>
					</el-col>
					<el-col :span="24">
						<el-form-item label="频次描述">
							<el-input v-model="submit.dosingFrequency" size="big"></el-input>
						</el-form-item>
					</el-col>
				</el-form>
			</el-row>
		</el-card>
	</div>
</template>

<script>
	export default {
		name:"gshSetCard",
		data () {
			return {
				ageOptions:[
					{
					  value: '岁',
					  label: '岁'
					},
					{
					  value: '月',
					  label: '月'
					},
					{
					  value: '天',
					  label: '天'
					},
				],
				dosingUnit_name:"",
				diseaseName:"",
				submit:{
					dosingUnit_code:"",
					dosingUnit:"ml",
					calculation:"1",
					degree:"1",
					age_low1:"0",
					ageLow:"",
					age_low_unit1:"岁",
					age_high1:"0",
					ageH:"",
					age_high_unit1:"岁",
					diseaseStates:"",
					doseRangeL:"",
					doseRangeH: "",
					dailyDoseL:"",
					dailyDoseH:"",
					dosingFrequencyLow: "",
					dosingFrequencyLowDay:"",
					dosingFrequencyHight:"",
					dosingFrequencyHightDay:"",
					dosingFrequency:""
				}
			}
		},
		props:{
			gyData:{
				type:Object
			},
			jbData:{
				type:Object
			}
		},
		watch:{
			gyData(val){
				this.dosingUnit_name=val.name;
				this.submit.dosingUnit_code=val.id
			},
			jbData(val){
				this.diseaseName=val.name;
				this.submit.diseaseStates=val.id;
			}
		},
		methods:{
			clearFun(type){
				if(type == 1){
					this.dosingUnit_name="";
					this.submit.dosingUnit_code="";
				}else{
					this.diseaseName="";
					this.submit.diseaseStates="";
				}
			},
			openSelect (type) {
				if(type == 1){
					this.$emit("selectPop","给药",this.submit.dosingUnit_code);
				}else{
					this.$emit("selectPop","疾病",this.submit.diseaseStates);
				}
			},
			resetFun(){
				this.dosingUnit_name="";
				this.diseaseName="";
				this.submit={
					dosingUnit_code:"",
					dosingUnit:"ml",
					calculation:"1",
					degree:"1",
					age_low1:"0",
					ageLow:"",
					age_low_unit1:"岁",
					age_high1:"0",
					ageH:"",
					age_high_unit1:"岁",
					diseaseStates:"",
					doseRangeL:"",
					doseRangeH: "",
					dailyDoseL:"",
					dailyDoseH:"",
					dosingFrequencyLow: "",
					dosingFrequencyLowDay:"",
					dosingFrequencyHight:"",
					dosingFrequencyHightDay:"",
					dosingFrequency:""
				};
			}
		}
	}
</script>

<style lang="scss" scoped>
	.el-card {
		margin-left: 3px;
	}
	.dialogFirstRow>>>.el-input {
		width: 70px;
		margin-right: 10px;
	}
	
	.el-form-item.s_selectbox>>>.el-form-item__content {
		width: 80%;
	}
	
	
	.demo-form-inline>>>.el-form-item {
		margin-bottom: 0px;
	}
	
	.dialogFirstRow>>>label {
		height:41px;
		display:inline-block;
	}
</style>